package leetcode_二叉树;

import general_class.TreeNode;

/**
 * 反转二叉树
 * 算法：递归
 *
 * @author yezh
 * @date 2024/1/12 17:31
 */
public class _226 {

    public TreeNode invertTree(TreeNode root) {
        if (root != null) {
            TreeNode tmp = root.left;
            root.left = root.right;
            root.right = tmp;
            invertTree(root.left);
            invertTree(root.right);
        }
        return root;
    }

}
